package hw;

public class Solution70 {

    public int climbStairs(int n) {
        // f(x) = f(x-1) + f(x-2);
        if (n == 0 || n == 1) {
            return 1;
        }
        int[] ints = new int[n + 1];
        ints[0] = 1;
        ints[1] = 1;
        for (int i = 2; i < n + 1; i++) {
            ints[i] = ints[i - 1] + ints[i - 2];
        }
        return ints[n];
    }

    public static void main(String[] args) {
        Solution70 solution70 = new Solution70();
        System.err.println(solution70.climbStairs(30));
    }
}
